<?php


require_once( "_inc.php" );
$categoryId = !empty( $_GET['cId'] ) ? intval( $_GET['cId'] ) : "";
$keyword = !empty( $_GET['q'] ) ? trim( $_GET['q'] ) : "";
$page = !empty( $_GET['p'] ) ? intval( $_GET['p'] ) : 1;
$orderby = !empty( $_GET['o'] ) ? trim( $_GET['o'] ) : "f_id ASC";
$tpl->assign( "categoryId", $categoryId );
$tpl->assign( "keyword", $keyword );
$tpl->assign( "page", $page );
$tpl->assign( "orderby", $orderby );
$condition = "";
if ( !empty( $categoryId ) )
{
	$condition = "f_categoryId='".$categoryId."'";
}
if ( !empty( $keyword ) )
{
	$condition = "f_name LIKE '%".$keyword."%' OR f_url LIKE '%{$keyword}%'";
}
$tpl->assign( "condition", $condition );
$tpl->assign( "backUrl", base64_encode( $_SERVER['REQUEST_URI'] ) );
$tpl->assign( "categoryDir", $gCategoryDir );
$tpl->display( );
?>
